/**
 * StoreParticularReportAction.java
 */
package com.prs.crm.action.ca.work;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.courser.ui.PaginationSupport;
import org.hibernate.criterion.DetachedCriteria;

import com.prs.crm.action.ReportAction;
import com.prs.crm.domain.ca.work.ArticleTook;
import com.prs.crm.domain.ca.work.DemandInventory;
import com.prs.crm.domain.ca.work.ProcureStore;
import com.prs.crm.report.ExportConfig;
import com.prs.crm.report.ReportCell;
import com.prs.crm.report.ReportTable;

/**
 * @author ZhuDongMei
 * @E-mail:1223984339@qq.com
 * @qq:1223984339
 * @version 创建时间：2011-3-16 上午11:12:28 简单说明
 */
public class StoreParticularReportAction extends ReportAction {

	private static final long serialVersionUID = 1L;
	private PaginationSupport pagination;
	public PaginationSupport getPagination() {
		return pagination;
	}
	public void setPagination(PaginationSupport pagination) {
		this.pagination = pagination;
	}
	@Action(value="exportStoreParticular", results = { @Result(name = "success"
		,type="stream",params={"contentType","${contentType}","inputName","inputStream"
		,"bufferSize","1024","contentDisposition","filename=${outfileName}"}) })
	public String exportStoreParticular()
	{
		ReportTable table = new ReportTable("入库明细");
		table.addCell(new ReportCell("单号","ps_billNumber"));
		table.addCell(new ReportCell("物品类别","articleInfo.ai_articleType.ca_at_typeName"));
		table.addCell(new ReportCell("品名","articleInfo.ai_articleName"));
		table.addCell(new ReportCell("规格","articleInfo.ai_articleStandard"));
		table.addCell(new ReportCell("数量","ps_number"));
		table.addCell(new ReportCell("单位","articleInfo.ai_articleUnit"));
		table.addCell(new ReportCell("单价","articleInfo.ai_articleUnivalence"));
		table.addCell(new ReportCell("金额","ps_money"));
		table.addCell(new ReportCell("入库日期","ps_storeDate"));
		table.addCell(new ReportCell("入库人","recorder.resume.name"));
		DetachedCriteria criteria = this.getPaginationHelper().createQuery(ProcureStore.class);
		this.setOutFilePath(this.getReportService().report(criteria, table, new ExportConfig(),this.getExportType()));
		return SUCCESS;
	}
	@Action(value="exportTookParticular", results = { @Result(name = "success"
		,type="stream",params={"contentType","${contentType}","inputName","inputStream"
		,"bufferSize","1024","contentDisposition","filename=${outfileName}"}) })
	public String exportTookParticular()
	{
		ReportTable table = new ReportTable("领用明细");
		table.addCell(new ReportCell("单号","at_billNumber"));
		table.addCell(new ReportCell("物品类别","demands.di_articletype.ca_at_typeName"));
		table.addCell(new ReportCell("品名","demands.di_articleName"));
		table.addCell(new ReportCell("规格","demands.di_articleStandard"));
		table.addCell(new ReportCell("数量","demands.di_articleNumber"));
		table.addCell(new ReportCell("单位","demands.di_articleUnit"));
		table.addCell(new ReportCell("领用申请人","person.resume.name"));
		table.addCell(new ReportCell("申请日期","at_applyDate"));
		DetachedCriteria criteria = this.getPaginationHelper().createQuery(ArticleTook.class);
		this.setOutFilePath(this.getReportService().report(criteria, table, new ExportConfig(),this.getExportType()));
		return SUCCESS;
	}
	@Action(value="exportDemandInventory", results = { @Result(name = "success"
		,type="stream",params={"contentType","${contentType}","inputName","inputStream"
		,"bufferSize","1024","contentDisposition","filename=${outfileName}"}) })
	public String exportDemandInventory()
	{
		ReportTable table = new ReportTable("库存查询");
		table.addCell(new ReportCell("物品类别","di_articletype.ca_at_typeName"));
		table.addCell(new ReportCell("品名","di_articleName"));
		table.addCell(new ReportCell("规格","di_articleStandard"));
		table.addCell(new ReportCell("数量","di_articleNumber"));
		table.addCell(new ReportCell("单位","di_articleUnit"));
		table.addCell(new ReportCell("单价","di_articleUnivalence"));
		table.addCell(new ReportCell("金额","di_money"));
		DetachedCriteria criteria = this.getPaginationHelper().createQuery(DemandInventory.class);
		this.setOutFilePath(this.getReportService().report(criteria, table, new ExportConfig(),this.getExportType()));
		return SUCCESS;
	}
}
